package com.example.rbacmanage.service.impl;

import com.example.rbacmanage.entity.OperLog;
import com.example.rbacmanage.exception.MyException;
import com.example.rbacmanage.mapper.OperLogMapper;
import com.example.rbacmanage.service.OperLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class OperLogServiceImpl implements OperLogService {
    @Autowired
    private OperLogMapper sysLogMapper;

    @Override
    public void save(OperLog sysLog) {
        sysLogMapper.insert(sysLog);
    }

    @Override
    public void remove(Long[] ids) {
        for(Long id:ids){
            sysLogMapper.del(id);
        }
    }

    @Override
    public void update(OperLog sysLog) {
        sysLogMapper.update(sysLog);
    }

    @Override
    public List<OperLog> getAll(OperLog sysLog) {
        return sysLogMapper.list(sysLog);
    }

    @Override
    public PageInfo<OperLog> getPage(OperLog sysLog) {
        PageHelper.startPage(sysLog.getPage(), sysLog.getLimit());
        return new PageInfo<>(sysLogMapper.list(sysLog));
    }

    @Override
    public OperLog getById(Long id) {
        return sysLogMapper.queryOneById(id);
    }

    @Override
    public Integer getCount(OperLog operLog) {
        return sysLogMapper.count(operLog);
    }

    @Override
    public void checkRepeat(OperLog operLog) throws MyException {

    }

}
